/**      
 * @file		arrayInitialization.cpp
 * @description		Demonstrates how arrays can be initialized. Remember
 *			arrays can be of any data type. Here I use char to demonstrate
 *			c-string initialization.
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
using namespace std;

/**
 * @return zero if the application executes successfully
 */
int main() {
	int size = 32;
	char myString[]		= "This is a string initialization.";
	char myStrin[33]	= "This is a string initialization.";		// if you change the size and don't give room
	char myStr[33]		= {'T', 'h', 'i', 's', ' ', 'i', 's', ' ',	// for the null, you get a compiler error
				   'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ',
				   'i', 'n', 'i', 't', 'i', 'a', 'l', 'i', 'z', 'a',
				   't', 'i', 'o', 'n', '.', '\0' };

	char mySt[]		= {'T', 'h', 'i', 's', ' ', 'i', 's', ' ',
				   'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ',
				   'i', 'n', 'i', 't', 'i', 'a', 'l', 'i', 'z', 'a',
				   't', 'i', 'o', 'n', '.', '\0' };

	char myStrings[33]	= {'T', 'h', 'i', 's', ' ', 'i', 's', ' ' };	// places '\0' at index 8
	
	cout << "'" << myStrings << "'" << endl;

	// The following lines are commented for experimentation. Uncomment to see what happens
	// we can't declare an array and then initialize it. It must be done in one statement

	//char myStr[33];
	//myStr = "This is a string initialization.";


	//cout << myString << endl;
	//cout << myStrin << endl;
	//cout << myStr << endl;
	//cout << "Outputting each element in the mySt array.\n";
	//for(int i = 0; i < size; i++) {
	//	cout << mySt[i]; 	// subscript the array to get individual elements
	//}
	//cout << endl;

	// stack iss corrupted by this code...
	// comment the next three lines to view the 
	// last line and what it will do

	//mySt[35] = 't';
	//cout << "Bad cout\n";
	//cout << mySt[35] << endl;

	// myStrings[20] = ' ';   //  initialized to a blank space
	// cout << "Incomplete CString '" << myStrings[20] << "'\n";
	return 0;
}

